<style lang="less">
  .card_style {
    height: 100%;
    width: 100%;
    overflow: hidden;
    .ivu-card-body {
      padding: 0px;
    }
  }
  .page_style {
    margin-top: 10px;
    text-align: right;
  }
  .bench_search {
    margin-bottom: 10px;
  }
  .nopadding .ivu-table-cell {
    padding: 0px 0px;
  }
  .item1{
    height: 42px;
    line-height: 40px;
  }
  .marginR2 {
    margin-right: 2%;
  }
  .fontsize20 {
    font-size: 20px;
  }
  .fontTitle {
    font-size: 20px;
    height: 52px;
    text-align: right;
    padding-top: 16px;
    // vertical-align: bottom;
  }
  .fontContent {
    font-size: 20px;
    height: 52px;
    text-align: left;
    padding-top: 16px;
    color: #dc9387;
    // vertical-align: bottom;
  }
  .countNum {
    font-size: 35px;
    color: #dc9387;
  }
  .new-btn-sty {
    margin-right: 5px;
    color: #fff;
    background-color: #235CA7;
    border-color: #235CA7;
    font-weight: 500;
  }
  .new-btn-sty1 {
    margin-right: 5px;
    color: #fff;
    background-color: #598ED1;
    border-color: #598ED1;
    font-weight: 500;
  }
  .text-overflow{
    width:300px; /* 超过宽度就显示... */
    text-overflow: ellipsis; /* 显示... */
    overflow: hidden; /* 隐藏文字 */
    white-space: nowrap; /* 不换行 */
    cursor: pointer; /* hover显示手形 */
  }
</style>

<template>
  <div>
    <Card class="card_style" :bordered="false" :dis-hover="true">
      <Tabs :animated="false" @on-click="getCountData" v-model="searchInfo.tab_index">
        <TabPane label="区域统计" name='sqtj'>
          <Row class="bench_search">
            <Col span="4" v-if="companyGrade < 2">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 3">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 4">
              <span>社区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchData"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem1(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListSQ" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.key" v-for="item in stateList" v-bind:key="item.key">{{item.value}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="exportData"><Icon type="ios-download-outline"/> 导出结果</Button>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="pranttable('printtable')"><Icon type="ios-print-outline"/> 打印结果</Button>
            </Col>
          </Row>
          <div id="printtable">
          <Table v-show="searchInfo.shape" :columns="columns1" :data="datalist" ref="table1"></Table>
          </div>
          <Row v-if="searchInfo.loading1 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
        </TabPane>
        <TabPane label="社区统计" name='sqtjnew'>
          <Row class="bench_search">
            <Col span="4" v-if="companyGrade < 2">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 3">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 4">
              <span>社区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchDatashequ(1)"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem1(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListSQ" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="6" >
              <span>排序类型：</span>
              <Select v-model="shequAsot" filterable transfer="" style="width: 70%;" >
                <Option :value="item.value" v-for="item in shequAsotList" v-bind:key="item.value">{{item.laber}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="exportDatashequ"><Icon type="ios-download-outline"/> 导出结果</Button>
            </Col>
          </Row>
          <Row>
            <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.key" v-for="item in stateList" v-bind:key="item.key">{{item.value}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>是否包含纸质证：</span>
              <Select v-model="searchInfo.ishavezzz" filterable transfer="" style="width: 55%;">
                <Option :value="1" >否</Option>
                <Option :value="0" >是</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>社区名称：</span>
              <Input v-model="searchInfo.community" placeholder="社区名称" clearable style="width: 70%" />
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="pranttable('printtable1')"><Icon type="ios-print-outline"/> 打印结果</Button>
            </Col>
          </Row>
          <div id="printtable1">
          <Table v-show="searchInfo.shape" :columns="columnsshequ" :data="datalistshequ" ref="tableshequ" style="margin-top:10px"></Table>
          </div>
          <Page :total="shequPageInfo.totalRecord" class="page_style" :current="shequPageInfo.pageNo"
                  :page-size="shequPageInfo.pageSize" @on-change="changeshequPageNo" show-total show-elevator show-sizer @on-page-size-change="changeshequsize"/>
          <Row v-if="searchInfo.loading1 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
        </TabPane>
        <TabPane label="事项办理统计" v-if="companyCode === 'LM'" name='sxbltj'>
          <Row class="bench_search">
            <Col span="4" v-if="companyCode === 'LM'">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyCode === 'LM'">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyCode === 'LM'">
              <span>社区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy-MM-dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime1"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchData1(searchInfo.applytime1, null)"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
            </Row>
            <Row class="bench_search">
            <!-- <Col span="8">
              <span>事项名称：</span>
              <Input v-model="searchInfo.item_name" placeholder="事项名称" clearable style="width: 70%" />
            </Col> -->
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem1(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListSQ" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <!-- <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.state" v-for="item in orderstate" v-bind:key="item.state">{{item.statename}}</Option>
              </Select>
            </Col> -->
            <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.key" v-for="item in stateList" v-bind:key="item.key">{{item.value}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="exportData1"><Icon type="ios-download-outline"></Icon> 导出结果</Button>
            </Col>
          </Row>
          <Table border :columns="columns2" :data="itemlist" ref="table2"></Table>
          <Row v-if="searchInfo.loading2 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
          <!-- <Modal v-model="itemModalInfo.show" :title="itemModalInfo.title" width="1000">
            <Table border :columns="columns3" :data="itemhandlelist" ref="table3"></Table>
            <Button type="error" @click="itemModalInfo.show=false">关闭</Button>
            <Row v-if="searchInfo.loading3 == true">
              <Col class="demo-spin-col" span="8" offset="8">
                <Spin fix>
                  <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                  <div>数据正在加载</div>
                </Spin>
              </Col>
            </Row>
            <Page :total="itemModalInfo.totalRecord" class="page_style" :current="itemModalInfo.pageNo"
                  :page-size="itemModalInfo.pageSize" @on-change="getHandleList"/>
            <div slot="footer">
              <Button type="info" @click="exportData2"><Icon type="ios-download-outline"></Icon> 导出本页名单</Button>
              <Button type="error" @click="itemModalInfo.show=false">关闭</Button>
            </div>
          </Modal> -->
        </TabPane>
        <TabPane label="工作量统计" name='worklist'>
          <Row class="bench_search">
            <Col span="4" v-if="companyGrade < 2">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 3">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6" v-if="companyGrade < 4">
              <span>社&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchDatawork"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="4" v-if="companyCode === 'LM'">
              <span>类型：</span>
              <Select v-model="searchInfo.workType" filterable transfer="" style="width: 70%;">
                <Option :value="item.code" v-for="item in workType" v-bind:key="item.code">{{item.name}}</Option>
              </Select>
            </Col>
            <Col span="4">
              <span>姓名：</span>
              <Input v-model="searchInfo.sq_name" placeholder="姓名(或登录名)" clearable style="width: 70%" />
            </Col>
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6" >
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListWK" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="exportDatawork"><Icon type="ios-download-outline"/> 导出结果</Button>
            </Col>
          </Row>
          <Row>
            <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.key" v-for="item in stateList" v-bind:key="item.key">{{item.value}}</Option>
              </Select>
            </Col>
          </Row>
          <Table v-show="searchInfo.shape" :columns="columnswork" :data="datalistwork" ref="tablework" stripe style="margin-top:10px"></Table>
          <Row v-if="searchInfo.loading1 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
          <Modal v-model="workModalInfo.show" :title="workModalInfo.title" width="1000">
             <Alert>
              <Form :model="searchObj" inline>
                <FormItem>
                 <Button class="search-btn" type="primary" @click="exportDataworkorder"><Icon type="ios-download-outline"></Icon> 导出名单</Button>
                </FormItem>
              </Form>
            </Alert>
            <Table border :columns="columns3" :data="itemhandlelist" ref="table3"></Table>
            <Row v-if="searchInfo.loading3 == true">
              <Col class="demo-spin-col" span="8" offset="8">
                <Spin fix>
                  <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                  <div>数据正在加载</div>
                </Spin>
              </Col>
            </Row>
            <Page :total="workModalInfo.totalRecord" class="page_style" :current="workModalInfo.pageNo"
                  :page-size="workModalInfo.pageSize" @on-change="changeworkPageNo" show-total show-elevator show-sizer @on-page-size-change="changeworksize"/>
          </Modal>
        </TabPane>
        <TabPane label="归类排名" v-if="companyCode === 'LM'" name='glpm'>
          <Row class="bench_search">
            <Col span="4" v-if="companyCode === 'LM'">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyCode === 'LM'">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6" v-if="companyCode === 'LM'">
              <span>社&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime2"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchData1(searchInfo.applytime2, '1')"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Table border :show-summary="false" :summary-method="handleSummary" :columns="columns4" :data="sortitemlist">
            <template slot="buttons" slot-scope="{ row }">
              <Button type="info" size="small" @click="glpmInfoAction(row)">办理名单</Button>
            </template>
            <template slot="item_id" slot-scope="{ row }">
              <span v-if="row.item_id != 'all'">{{row.item_id}}</span>
              <span v-else></span>
            </template>
          </Table>
          <Row v-if="searchInfo.loading4 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
          <Col span="16" offset="4">
            <Card :bordered="false" :dis-hover="true">
              <my-chart-pie style="height: 400px;margin-top:50px" :value="sortitemlist" :run="searchInfo.runPie" :showLegend="true"/>
            </Card>
          </Col>
          <!-- <Col>
            <Row v-show="!searchInfo.barflag" >
              <Col class="demo-spin-col" style="height: 400px;">
                <Spin fix>
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>
              </Col>
            </Row>
            <my-chart-bar style="height: 500px;" v-if="searchInfo.barflag" :value="barData"
                          :run="searchInfo.runBar" text="受理柱状图"/>
          </Col> -->
          <Col span="16" offset="4">
            <Card :bordered="false" :dis-hover="true">
              <my-chart-bar style="height: 400px" :value="barDataTab3" :run="searchInfo.runTab3Bar2" text="柱状图"/>
            </Card>
          </Col>
        </TabPane>
        <TabPane label="受理趋势图" v-if="companyCode === 'LM'" name='slqst'>
          <Row class="bench_search">
            <Col span="6" v-if="companyCode === 'LM'">
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id2" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListSC" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="6" v-if="companyCode === 'LM'">
              <span>类型：</span>
              <Select v-model="searchInfo.AcceptListType" filterable transfer="" style="width: 70%;">
                <Option :value="item.code" v-for="item in acceptListType" v-bind:key="item.code">{{item.name}}</Option>
              </Select>
            </Col>
            <Col span="8">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime3"></DatePicker>
            </Col>
             <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchData2"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="6" v-if="companyCode === 'LM'">
              <span>区&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;县：</span>
              <Select v-model="searchInfo.level1" transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6" v-if="companyCode === 'LM'">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="8" v-if="companyCode === 'LM'">
              <span>社&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</span>
              <Select v-model="searchInfo.level3" transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
          </Row>
          <Col>
            <Row v-show="!searchInfo.barflag" >
              <Col class="demo-spin-col" style="height: 400px;">
                <Spin fix>
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>
              </Col>
            </Row>
            <my-chart-bar style="height: 500px;" v-if="searchInfo.barflag" :value="barData"
                          :run="searchInfo.runBar" text="受理柱状图"/>
          </Col>
          <Col>
            <Row v-show="!searchInfo.barflag" >
              <Col class="demo-spin-col" style="height: 400px;">
                <Spin fix>
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>
              </Col>
            </Row>
            <accept-line-echart style="height: 500px;" v-if="searchInfo.barflag" :value="barData"
                                :run="searchInfo.runBar" text="受理折线图"></accept-line-echart>
          </Col>
        </TabPane>
        <TabPane label="阶段性汇总" v-if="companyCode === 'LM'" name='jdxhz'>
          <Row class="bench_search">
            <Col span="8">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime3"></DatePicker>
            </Col>
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem1(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListSQ" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchData3"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="report"><Icon type="md-paper" /> 查看报告</Button>
            </Col>
          </Row>
          <Row v-if="searchInfo.loadingjdxhz == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
          <Row class="bench_search" v-if="searchInfo.loadingjdxhz != true">
            <Col span="8" style="height: 400px;">
              <Card dis-hover>
                <p slot="title"><Icon type="ios-podium-outline" /> 事项办理排名</p>
                <div style="margin: 10px 5px" v-for="(item, index) in tab5list1" v-bind:key="item.id">
                  <span style="margin: 10px" v-if="index < 10">{{index+1}}</span>
                  <span style="margin: 10px" v-else>&nbsp;&nbsp;</span>
                  <span style="margin: 10px">{{item.name}}</span>
                  <span style="float: right; margin-right: 10px;">{{item.value}}件</span>
                </div>
              </Card>
            </Col>
            <!-- <Row v-if="!searchInfo.tab5Pie1">
              <Col class="demo-spin-col" style="height: 400px;">
                <Spin fix>
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>
              </Col>
            </Row> -->
            <Col span="16">
              <Card :bordered="false" :dis-hover="true">

                <Spin fix v-if="!searchInfo.tab5Pie1" style="height: 400px;">
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>

                <my-chart-pie style="height: 400px;" :value="tab5list1" v-if="searchInfo.tab5Pie1"
                              :run="searchInfo.runTab5Pie1" :showLegend="false"/>
              </Card>
            </Col>
          </Row>
          <Row class="bench_search" v-if="searchInfo.loadingjdxhz != true">
            <Col span="8">
              <Card dis-hover>
                <p slot="title"><Icon type="ios-podium-outline" /> 区域受理排名</p>
                <div style="margin: 10px 5px" v-for="(item, index) in stageSummaryList" v-bind:key="item.id">
                  <span style="margin: 10px">{{index+1}}</span>
                  <span style="margin: 10px">{{item.sq_name}}</span>
                  <span style="float: right; margin-right: 10px;">{{item.num}}</span>
                </div>
              </Card>
            </Col>
            <Col span="16">
              <Card :bordered="false" :dis-hover="true">

                 <Spin fix v-if="!searchInfo.tab5Bar2" style="height: 400px;">
                  <Icon type="ios-loading" size=60 class="demo-spin-icon-load"></Icon>
                </Spin>

                <my-chart-bar style="height: 400px;" :value="barDataTab5" :run="searchInfo.runTab5Bar2"
                              v-if="searchInfo.tab5Bar2"/>
              </Card>
            </Col>
          </Row>
          <!-- 阶段性汇总报告 -->
          <Modal v-model="modalTab5Info.show" :title="modalTab5Info.title" width="700" :closable="false">
            <Form label-position="right" :label-width="100">
              <Row>
                <Col span="10" class="fontTitle">本阶段受理的事项数为:</Col>
                <Col span="10" offset="1" class="fontsize20">
                  <div class="count-to-con">
                    <count-to :end="modalTab5Info.num" count-class="countNum">
                      <span slot="right">&nbsp;件</span>
                    </count-to>
                  </div>
                </Col>
              </Row>
              <Row>
                <Col span="10" class="fontTitle">办结的事项数为:</Col>
                <Col span="10" offset="1" class="fontsize20">
                  <div class="count-to-con">
                    <count-to :end="modalTab5Info.finish_num" count-class="countNum">
                      <span class="slot-text" slot="right">&nbsp;件</span>
                    </count-to>
                  </div>
                </Col>
              </Row>
              <Row>
                <Col span="10" class="fontTitle">受理事项最多的社区:</Col>
                <Col span="10" offset="1" class="fontContent">
                  <Icon type="ios-ribbon" size="25"/> {{modalTab5Info.maxSQname}}
                </Col>
              </Row>
              <Row>
                <Col span="10" class="fontTitle">受理最多的事项:</Col>
                <Col span="10" offset="1" class="fontContent">
                  <Tooltip  max-width="200" :content="modalTab5Info.maxItemName" >
                    <div class="text-overflow"><Icon type="ios-ribbon" size="25"/>{{modalTab5Info.maxItemName}}</div>
                  </Tooltip>
                </Col>
              </Row>
              <Row>
                <Col span="10" offset="1">
                  <Card>
                    <p slot="title"><Icon type="ios-ribbon" /> {{modalTab5Info.maxSQname}}</p>
                    <Row type="flex" justify="center" align="middle" class="countto-page-row">
                      <div class="count-to-con">
                        <count-to :end="modalTab5Info.maxSQ" count-class="countNum">
                          <span class="slot-text" slot="left">受理量:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;件</span>
                        </count-to>
                        <count-to :end="modalTab5Info.maxSQ2" count-class="countNum">
                          <span class="slot-text" slot="left">办结量:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;件</span>
                        </count-to>
                        <count-to :end="modalTab5Info.maxSQ3" count-class="countNum">
                          <span class="slot-text" slot="left">办结率:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;%</span>
                        </count-to>
                      </div>
                    </Row>
                  </Card>
                </Col>
                <Col span="10" offset="1">
                  <Card>
                    <p slot="title"><Icon type="ios-ribbon" /> {{modalTab5Info.maxItemName}}</p>
                    <Row type="flex" justify="center" align="middle" class="countto-page-row">
                      <div class="count-to-con">
                        <count-to :end="modalTab5Info.maxItem" count-class="countNum">
                          <span class="slot-text" slot="left">受理量:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;件</span>
                        </count-to>
                        <count-to :end="modalTab5Info.maxItem2" count-class="countNum">
                          <span class="slot-text" slot="left">办结量:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;件</span>
                        </count-to>
                        <count-to :end="modalTab5Info.maxItem3" count-class="countNum">
                          <span class="slot-text" slot="left">办结率:&nbsp;</span>
                          <span class="slot-text" slot="right">&nbsp;%</span>
                        </count-to>
                      </div>
                    </Row>
                  </Card>
                </Col>
              </Row>
            </Form>
            <div slot="footer">
              <Button type="error" @click="modalTab5Info.show=false">关闭</Button>
            </div>
          </Modal>
        </TabPane>
        <TabPane label="问题咨询统计" v-if="false" name='wtcxtj'>
          <Row class="bench_search">
            <Col span="8">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="apptime"></DatePicker>
            </Col>
            <Col span="2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="findtime(true)"><Icon type="ios-search" /> 搜索</Button>
            </Col>
          </Row>
          <Table border :columns="columns5" :data="rowlist" ref="table3"></Table>
          <Modal v-model="listdetails"  :title="info1" width="1000">
            <Table border :columns="columns6" :data="listdetailsdata" ref="table5"></Table>
            <Page :total="totalnum" class="page_style" :current="currentpageNo" show-total show-elevator show-sizer :page-size="currentpageSize" @on-change="change3"/>
            <div slot="footer">
              <!--<Button type="info" @click="exportData2"><Icon type="ios-download-outline"></Icon> 导出本页名单</Button>-->
              <Button type="error" @click="listdetails=false">关闭</Button>
            </div>
          </Modal>
        </TabPane>
        <TabPane label="各社区问题咨询统计" v-if="false" name='gsqwtzxtj'>
          <Row class="bench_search">
            <Col span="8">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="apptime"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="findtime(false)"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Table border :columns="columns7" :data="rowlist2" ref="table4"></Table>
          <Modal v-model="listdetailss"  :title="info1" width="1000">
            <Table border :columns="columns8" :data="listdetailsdataaa" ref="table5"></Table>
            <Page :total="totalnum" class="page_style" :current="currentpageNo" show-total show-elevator show-sizer :page-size="currentpageSize" @on-change="change1"/>
            <div slot="footer">
              <!--<Button type="info" @click="exportData2"><Icon type="ios-download-outline"></Icon> 导出本页名单</Button>-->
              <Button type="error" @click="listdetailss=false">关闭</Button>
            </div>
          </Modal>
        </TabPane>
        <TabPane label="事项办理时限统计" v-if="false" name='sxblsxtj'>
          <Table border :columns="columns10" :data="itemTimelist" >
            <template slot-scope="{ row, index }" slot="item_time">
              <span v-if="row.item_time==null ||row.item_time==undefined || row.item_time==''">0小时</span>
              <span v-else>{{time(row.item_time)}}小时</span>
            </template>
          </Table>
          <Row v-if="searchInfo.itemtime == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
        </TabPane>
        <TabPane label="事项办结率统计" v-if="false" name='sxbjltj'>
          <Table border :columns="forwardColumns" :data="forwardList" >
            <template slot-scope="{ row, index }" slot="company_code">
              <span >{{row.company_name + '('+row.company_code+')'}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="num1">
              <span >{{row.num1-row.zhuan_num}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="finish_num">
              <span >{{row.finish_num-row.finish_zhuan_num}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="item_rate">
              <span >{{rate(row)}}</span>
            </template>
            <template slot-scope="{ row, index }" slot="item_forward_rate">
              <span v-if="row.finish_zhuan_num==0 ||row.zhuan_num==0 ">无转件</span>
              <span v-else>{{forward(row)}}</span>
            </template>
          </Table>
          <Page :current="pageNo" :page-size="pageSize"  :total="totalRecord"
                 @on-change="changePage"  class="page_style" show-total show-elevator show-sizer @on-page-size-change="size"/>
          <Row v-if="searchInfo.forw == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
        </TabPane>
        <TabPane label="社区办理时限统计" v-if="false" name='sqblsx'>
          <Row class="bench_search">
            <Col span="4" v-if="companyGrade < 2">
              <span>区县：</span>
              <Select v-model="searchInfo.level1" filterable transfer="" @on-change="getMailList(searchInfo.level1,1,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[0]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="4" v-if="companyGrade < 3">
              <span>街道：</span>
              <Select v-model="searchInfo.level2" filterable transfer="" @on-change="getMailList(searchInfo.level2,2,null)" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[1]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6" v-if="companyGrade < 4">
              <span>社&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区：</span>
              <Select v-model="searchInfo.level3" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in mailList[2]" v-bind:key="item.id">{{item.title}}</Option>
              </Select>
            </Col>
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime"></DatePicker>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchDatatime"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="4" v-if="companyCode === 'LM'">
              <span>类型：</span>
              <Select v-model="searchInfo.workType" filterable transfer="" style="width: 70%;">
                <Option :value="item.code" v-for="item in workType" v-bind:key="item.code">{{item.name}}</Option>
              </Select>
            </Col>
            <Col span="4">
              <span>姓名：</span>
              <Input v-model="searchInfo.sq_name" placeholder="姓名(或登录名)" clearable style="width: 70%" />
            </Col>
            <Col span="6" >
              <span>事项类型：</span>
              <Select v-model="searchInfo.item_type" filterable transfer="" style="width: 70%;" @on-change="changeItem(searchInfo.item_type)">
                <Option :value="item.id" v-for="item in treelist" v-bind:key="item.id">{{item.type_name}}</Option>
              </Select>
            </Col>
            <Col span="6" >
              <span>事项名称：</span>
              <Select v-model="searchInfo.item_id" filterable transfer="" style="width: 70%;">
                <Option :value="item.id" v-for="item in eventListWK" v-bind:key="item.id">{{item.text}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty1" @click="exportDatatime"><Icon type="ios-download-outline"/> 导出结果</Button>
            </Col>
          </Row>
          <Table v-show="searchInfo.shape" :columns="columnstime" :data="datalisttime" ref="tabletime" stripe>
            <!-- <template slot-scope="{ row, index }" slot="item_time">
              <span v-if="row.item_time==null ||row.item_time==undefined || row.item_time==''">0小时</span>
              <span v-else>{{time(row.item_time)}}小时</span>
            </template>
            <template slot-scope="{ row, index }" slot="avgTime">
              <span v-if="row.avgTime==null ||row.avgTime==undefined || row.avgTime==''">0小时</span>
              <span v-else>{{time(row.avgTime)}}小时</span>
            </template> -->
          </Table>
          <Row v-if="searchInfo.loading1 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
          <!-- <Modal v-model="workModalInfo.show" :title="workModalInfo.title" width="1000">
             <Alert>
              <Form :model="searchObj" inline>
                <FormItem>
                 <Button class="search-btn" type="primary" @click="exportDataworkorder"><Icon type="ios-download-outline"></Icon> 导出名单</Button>
                </FormItem>
              </Form>
            </Alert>
            <Table border :columns="columnstime" :data="datalisttime" ref="table3"></Table>
            <Row v-if="searchInfo.loading3 == true">
              <Col class="demo-spin-col" span="8" offset="8">
                <Spin fix>
                  <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                  <div>数据正在加载</div>
                </Spin>
              </Col>
            </Row>
            <Page :total="workModalInfo.totalRecord" class="page_style" :current="workModalInfo.pageNo"
                  :page-size="workModalInfo.pageSize" @on-change="changeworkPageNo" show-total show-elevator show-sizer @on-page-size-change="changeworksize"/>
          </Modal> -->
        </TabPane>
        <TabPane label="社区人口数量管理" name='sqrkslgl' v-if="companyGrade === 4">
          <Row>
          <Card style="width:350px;float:left;margin-left:20px" @click.native="addpopulation">
            <div style="text-align:center;height:70px;line-height:70px">
                <h2>实际居住人口：{{population.population_num}}</h2>
            </div>
          </Card>
          <Card style="width:350px;float:left;margin-left:20px" @click.native="addpopulation">
            <div style="text-align:center;height:70px;line-height:70px">
                <h2>户籍人口：{{population.household_num}}</h2>
            </div>
          </Card>
          <Card style="width:350px;float:left;margin-left:20px" @click.native="addpopulation">
            <div style="text-align:center;height:70px;line-height:70px">
                <h2>流动人口：{{population.flow_num}}</h2>
            </div>
          </Card>
          </Row>
          <Modal
              v-model="population.show"
              title="请输入人口数量"
              @on-ok="savepopulationok"
              @on-cancel="savepopulationcancel">
              <Form ref="population" :model="population" label-position="right" :label-width="180">
                <FormItem label="实际居住人口数：" prop="setnum1">
                    <Input v-model="population.setnum1" type="number" style="width: 200px;margin-left:10px" /></Input>
                </FormItem>
                <FormItem label="户籍人口数：" prop="setnum2">
                    <Input v-model="population.setnum2" type="number" style="width: 200px;margin-left:10px" /></Input>
                </FormItem>
                <FormItem label="流动人口数：" prop="setnum3">
                    <Input v-model="population.setnum3" type="number" style="width: 200px;margin-left:10px" /></Input>
                </FormItem>
              </Form>
          </Modal>
          <Table :columns="columnspopulation" :data="population.loglist" ref="tabletpopulationlog" stripe style="margin-top:10px"></Table>
          <Page :total="population.totalRecord" class="page_style" :current="population.pageNo"
                  :page-size="population.pageSize" @on-change="changepopulationPageNo" show-total show-elevator show-sizer @on-page-size-change="changepopulationPageSize"/>
          <Row v-if="searchInfo.loading1 == true">
            <Col class="demo-spin-col" span="8" offset="8">
              <Spin fix>
                <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
                <div>数据正在加载</div>
              </Spin>
            </Col>
          </Row>
        </TabPane>
        <TabPane label="日常查询" name='rccx' v-if="companyGrade === 1">
          <Row class="bench_search">
            <Col span="6">
              <span>时间范围：</span>
              <DatePicker type="datetimerange" format="yyyy/MM/dd" transfer="" style="width: 70%"
                          placement="bottom-end" v-model="searchInfo.applytime"></DatePicker>
            </Col>
            <Col span="6">
              <span>办理状态：</span>
              <Select v-model="searchInfo.orderstateList" multiple :max-tag-count="1" filterable transfer="" style="width: 70%;">
                <Option :value="item.key" v-for="item in stateList" v-bind:key="item.key">{{item.value}}</Option>
              </Select>
            </Col>
            <Col span="2" class="marginR2" style="float:right" pull="1">
              <Button class="new-btn-sty" @click="searchRichang(searchInfo.applytime)"><Icon type="ios-search" /> 查询统计</Button>
            </Col>
          </Row>
          <Row class="bench_search">
            <Col span="24">
              全市社区通过“全市通办”服务管理平台共受理居民服务事项{{rc.num1}}件次，
            </Col>
            <Col span="24">
              其中办结数据（成功+失败）{{rc.num7}}件次。
            </Col>
            <Col span="24">
              比对数据{{num6}}件次。
            </Col>
            <Col span="24">
              减少重复要件{{rc.num2}}件次。
            </Col>
            <Col span="24">
              目前已划分电子网格{{rc.num4}}个次。
            </Col>
            <Col span="24">
              包含{{num5}}栋楼宇。
            </Col>
            <Col span="24">
              {{rc.num3}}余居民。
            </Col>
          </Row>
        </TabPane>
      </Tabs>
      <Modal v-model="itemModalInfo.show" :title="itemModalInfo.title" width="1000">
        <Alert>
        <Form :model="searchObj" inline>
          <FormItem>
            <Button class="search-btn" type="primary" @click="exportData3"><Icon type="ios-download-outline"></Icon> 导出名单</Button>
          </FormItem>
        </Form>
      </Alert>
      <Table border :columns="columns3" :data="itemhandlelist" ref="table3"></Table>
      <Row v-if="searchInfo.loading3 == true">
        <Col class="demo-spin-col" span="8" offset="8">
          <Spin fix>
            <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
            <div>数据正在加载</div>
          </Spin>
        </Col>
      </Row>
      <Page :total="itemModalInfo.totalRecord" class="page_style" :current="itemModalInfo.pageNo"
            :page-size="itemModalInfo.pageSize" @on-change="changeItemDetailPageNo" show-total show-elevator show-sizer @on-page-size-change="itemDetailsize"/>
    </Modal>
    </Card>
    <glpm-modal ref="glpmModal" :modal-title="glpmModal.title" :dataObj="glpmModal.data"></glpm-modal>
  </div>
</template>

<script>
import { eventlist, getMailLevelList, date2str, getCompanyCountList, getPeriodList, getItemHandleList, getAcceptList, byRowidList, byQlnameInfo, findStreetNum, byCreatebyInfoList, getOrderAvgTimeList, getForwardRateList, getWorkList, getItemHandleToExcelList, treelist, findWorkOrderList, findWorkOrderToExcelList, getNewOrderAvgTimeList, getCompanyCountPageList, getCompanyCountExcelList, savePopulationNum, getPopulationNum, findPopulationNumLogList, getSomeNum, dycgetSomeNum, getBuildingNum } from '@/api/eventlist'
import { MyChartPie, MyChartBar } from '_c/charts'
import CountTo from '_c/count-to'
import AcceptLineEchart from '_c/charts/accept-line-echart/new'
import GlpmModal from './components/glpm-modal'
export default {
  name: 'closingratelist',
  components: {
    GlpmModal,
    AcceptLineEchart,
    MyChartPie,
    MyChartBar,
    CountTo
  },
  data () {
    return {
      pageNo: 1,
      totalRecord: 0,
      pageSize: 10,
      glpmModal: {
        title: '',
        data: {}
      },
      rc: {
        num1: '',
        num2: '',
        num3: '',
        num4: ''
      },
      num6: '',
      num5: '',
      population: {
        flow_num: '',
        household_num: '',
        population_num: '',
        setnum1: '',
        setnum2: '',
        setnum3: '',
        show: false,
        loglist: [],
        totalRecord: 0,
        pageNo: 1,
        pageSize: 10
      },
      searchObj: {},
      rowlist: [],
      apptime: [],
      currentpageNo: 1,
      currentpageSize: 10,
      totalnum: 0,
      rowlist2: [],
      info1: '名单详情',
      listdetailsdata: [],
      getparam: {},
      listdetails: false,
      listdetailss: false,
      listdetailsdataaa: [],
      searchInfo: {
        tab_index: 0,
        // tab1页面内图表转换控制 true为表 false为图
        shape: true,
        runPie: 0,
        runBar: '0',
        runTab5Pie1: 0,
        runTab5Bar2: '0',
        runTab3Bar2: '0',
        barflag: true,
        tab5Pie1: true,
        tab5Bar2: true,
        level1: 0,
        item_id: '',
        item_id2: '',
        applytime: [],
        applytime1: [],
        applytime2: [],
        applytime3: [],
        loading1: true,
        loading2: true,
        loading3: true,
        loading4: true,
        workType: '1',
        ishavezzz: 0,
        orderstateList: []
      },
      barData: {
        legend: ['受理量', '同比受理量', '环比受理量'],
        xAxis: [],
        xAxisMap: {},
        seriesData: [
          { name: '受理量', data: [], type: 'bar' },
          { name: '同比受理量', data: [], type: 'bar' },
          { name: '环比受理量', data: [], type: 'bar' }
        ]
      },
      barDataTab3: {
        legend: ['受理量'],
        xAxis: [],
        xAxisMap: {},
        seriesData: [
          { name: '受理量', data: [], type: 'bar' }
        ]
      },
      barDataTab5: {
        legend: ['受理量', '办结量'],
        xAxis: [],
        seriesData: [
          { name: '受理量', data: [], type: 'bar' },
          { name: '办结量', data: [], type: 'bar' }
        ]
      },
      // 第5tab页汇总统计报告弹出框
      modalTab5Info: {
        show: false,
        num: 0,
        finish_num: 0,
        maxItem: 0,
        maxItem2: 0,
        maxItem3: 0,
        maxSQ: 0,
        maxSQ2: 0,
        maxSQ3: 0
      },
      // 第二tab页的事项办理名单弹出框
      itemModalInfo: { show: false, pageNo: 1, pageSize: 10, currentPageNo: 1, currentPageSize: 10 },
      // 工作量统计办理名单弹出框
      workModalInfo: { show: false, pageNo: 1, pageSize: 10, currentPageNo: 1, currentPageSize: 10 },
      // 第一tab页社区统计列表数据
      datalist: [],
      // 第5个tab页中事项办理数据
      tab5list1: [],
      // 第5个tab页阶段汇总数据
      stageSummaryList: [],
      // 第二tab页事项办理统计数据
      itemlist: [],
      // 工作量统计列表数据
      datalistwork: [],
      // 社区统计new
      datalistshequ: [],
      shequPageInfo: { pageNo: 1, pageSize: 10, currentPageNo: 1, currentPageSize: 10, totalRecord: 0 },
      // 时限tab页
      itemTimelist: [],
      // 事项转件办结率tab页
      forwardList: [],
      // 第三tab页归类排名数据
      sortitemlist: [],
      // 第二tab页事项办理名单数据
      itemhandlelist: [],
      // 社区办理时限统计
      datalisttime: [],
      mailList: [[], [], []],
      eventListSC: [],
      eventListSQ: [],
      eventListWK: [],
      orderstate: [
        { state: '', statename: '全部' },
        { state: '0', statename: '待受理' },
        { state: '2', statename: '办结成功' },
        { state: '3', statename: '办结失败' }
      ],
      treelist: [],
      acceptListType: [
        { code: 'day', name: '日受理趋势' },
        { code: 'week', name: '周受理趋势' },
        { code: 'month', name: '月受理趋势' }
      ],
      workType: [
        { code: '1', name: '社区' },
        { code: '2', name: '个人' }
      ],
      columns1: [
        { title: '序号', type: 'index', key: 'index', width: 100, align: 'center' },
        { title: '办理机构名称',
          key: 'sq_name',
          width: 200,
          align: 'center',
          render: (h, params) => {
            let para = {
              item_id: this.searchInfo.item_id,
              sq_name: this.searchInfo.sq_name,
              start_time: date2str(this.searchInfo.applytime[0]),
              end_time: date2str(this.searchInfo.applytime[1])
            }
            if (this.companyCode === 'LM') {
              para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
              para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : '1'
            } else {
              para.level = '4'
            }
            if (this.searchInfo.sq_name) {
              para.level = '4'
            }
            if (para.level === '4') {
              let sq_name_all = ''
              if (params.row.sq_name_all) {
                sq_name_all = params.row.sq_name_all
              } else {
                sq_name_all = params.row.sq_name
              }
              return h('Poptip', {
                props: {
                  trigger: 'hover',
                  content: sq_name_all,
                  placement: 'top'
                }
              },
              [
                (params.row.sq_name)
              ])
            } else {
              return [
                (params.row.sq_name)
              ]
            }
          }
        },
        { title: '受理量（项）', key: 'num', width: 200, align: 'center', sortable: true },
        { title: '办结量（项）', key: 'finish_num', width: 200, align: 'center', sortable: true },
        { title: '转件量（项）', key: 'outzhuan_num', width: 200, align: 'center', sortable: true },
        // {
        //   title: '办结率',
        //   key: 'percent',
        //   width: 200,
        //   sortable: true,
        //   align: 'center',
        //   render: (h, params) => {
        //     return h('div', [h('strong', params.row.percent.toFixed(2) + '%')])
        //   }
        // },
        { title: '转件受理量（项）', key: 'zhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件办结量（项）', key: 'finish_zhuan_num', width: 200, align: 'center', sortable: true }
        // {
        //   title: '转件办结率',
        //   key: 'zhuan_percent',
        //   width: 200,
        //   sortable: true,
        //   align: 'center',
        //   render: (h, params) => {
        //     return h('div', [h('strong', params.row.zhuan_percent.toFixed(2) + '%')])
        //   }
        // }
      ],
      columnsshequ: [
        { title: '序号', type: 'index', key: 'index', width: 100, align: 'center' },
        { title: '办理机构名称',
          key: 'sq_name',
          width: 200,
          align: 'center',
          render: (h, params) => {
            let para = {
              item_id: this.searchInfo.item_id,
              sq_name: this.searchInfo.sq_name,
              start_time: date2str(this.searchInfo.applytime[0]),
              end_time: date2str(this.searchInfo.applytime[1])
            }
            if (this.companyCode === 'LM') {
              para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
              para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : '1'
            } else {
              para.level = '4'
            }
            if (this.searchInfo.sq_name) {
              para.level = '4'
            }
            if (para.level === '4') {
              let sq_name_all = ''
              if (params.row.sq_name_all) {
                sq_name_all = params.row.sq_name_all
              } else {
                sq_name_all = params.row.sq_name
              }
              return h('Poptip', {
                props: {
                  trigger: 'hover',
                  content: sq_name_all,
                  placement: 'top'
                }
              },
              [
                (params.row.sq_name)
              ])
            } else {
              return [
                (params.row.sq_name)
              ]
            }
          }
        },
        { title: '受理量（项）', key: 'num', width: 200, align: 'center', sortable: true },
        { title: '办结量（项）', key: 'finish_num', width: 200, align: 'center', sortable: true },
        { title: '转件量（项）', key: 'outzhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件受理量（项）', key: 'zhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件办结量（项）', key: 'finish_zhuan_num', width: 200, align: 'center', sortable: true },
        { title: '平均办结时间', key: 'item_time', width: 200, align: 'center', sortable: true },
        { title: '全市平均办结时间', key: 'avgTime', width: 200, align: 'center', sortable: true },
        { title: '社区人口数量', key: 'population_num', width: 200, align: 'center', sortable: true },
        {
          title: '办件人口比',
          key: 'percent_pop',
          width: 200,
          sortable: true,
          align: 'center',
          render: (h, params) => {
            return h('div', [h('strong', params.row.percent_pop.toFixed(2) + '%')])
          }
        },
        {
          title: '转件人口比',
          key: 'zhuan_percent_pop',
          width: 200,
          sortable: true,
          align: 'center',
          render: (h, params) => {
            return h('div', [h('strong', params.row.zhuan_percent_pop.toFixed(2) + '%')])
          }
        }
      ],
      shequAsotList: [
        { laber: '受理量（项）倒序', value: 'num desc' },
        { laber: '受理量（项）正序', value: 'num asc' },
        { laber: '办结量（项）倒序', value: 'finish_num desc' },
        { laber: '办结量（项）正序', value: 'finish_num asc' },
        { laber: '转件量（项）倒序', value: 'outzhuan_num desc' },
        { laber: '转件量（项）正序', value: 'outzhuan_num asc' },
        { laber: '转件受理量（项）倒序', value: 'zhuan_num desc' },
        { laber: '转件受理量（项）正序', value: 'zhuan_num asc' },
        { laber: '转件办结量（项）倒序', value: 'finish_zhuan_num desc' },
        { laber: '转件办结量（项）正序', value: 'finish_zhuan_num asc' },
        { laber: '社区人口数量倒序', value: 'population_num desc' },
        { laber: '社区人口数量正序', value: 'population_num asc' },
        { laber: '办件人口比倒序', value: 'percent_pop desc' },
        { laber: '办件人口比正序', value: 'percent_pop asc' },
        { laber: '转件人口比倒序', value: 'zhuan_percent_pop desc' },
        { laber: '转件人口比正序', value: 'zhuan_percent_pop asc' },
        { laber: '平均办结时长倒序', value: 'item_time desc' },
        { laber: '平均办结时长正序', value: 'item_time asc' }
      ],
      shequAsot: 'num desc',
      columnswork: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '办理机构名称',
          key: 'sq_name',
          width: 200,
          align: 'center',
          render: (h, params) => {
            let sq_name_all = ''
            if (params.row.sq_name_all) {
              sq_name_all = params.row.sq_name_all
            } else {
              sq_name_all = params.row.sq_name
            }
            return h('Poptip', {
              props: {
                trigger: 'hover',
                content: sq_name_all,
                placement: 'top'
              }
            },
            [
              (params.row.sq_name)
            ])
          }
        },
        { title: '办结量（项）', key: 'finish_num', width: 200, align: 'center', sortable: true },
        { title: '受理量（项）', key: 'num', width: 200, align: 'center', sortable: true },
        { title: '转件量（项）', key: 'outzhuan_num', width: 200, align: 'center', sortable: true },
        // {
        //   title: '办结率',
        //   key: 'percent',
        //   width: 200,
        //   sortable: true,
        //   align: 'center',
        //   render: (h, params) => {
        //     return h('div', [h('strong', params.row.percent.toFixed(2) + '%')])
        //   }
        // },
        { title: '转件办结量（项）', key: 'finish_zhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件受理量（项）', key: 'zhuan_num', width: 200, align: 'center', sortable: true },
        // {
        //   title: '转件办结率',
        //   key: 'zhuan_percent',
        //   width: 200,
        //   sortable: true,
        //   align: 'center',
        //   render: (h, params) => {
        //     return h('div', [h('strong', params.row.zhuan_percent.toFixed(2) + '%')])
        //   }
        // },
        {
          title: '操作',
          key: 'action',
          width: 150,
          align: 'center',
          className: 'nopadding',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'info', size: 'small' },
                style: {},
                on: {
                  click: () => {
                    this.workOrderList(params.row)
                  }
                }
              }, '办理名单')
            )
            return h('div', temp)
          }
        }
      ],
      columnstime: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '办理机构名称',
          key: 'sq_name',
          width: 300,
          align: 'center',
          render: (h, params) => {
            let para = {
              item_id: this.searchInfo.item_id,
              sq_name: this.searchInfo.sq_name,
              start_time: date2str(this.searchInfo.applytime[0]),
              end_time: date2str(this.searchInfo.applytime[1])
            }
            if (this.companyCode === 'LM') {
              para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
              para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : '1'
            } else {
              para.level = '4'
            }
            if (this.searchInfo.sq_name) {
              para.level = '4'
            }
            if (para.level === '4') {
              let sq_name_all = ''
              if (params.row.sq_name_all) {
                sq_name_all = params.row.sq_name_all
              } else {
                sq_name_all = params.row.sq_name
              }
              return h('Poptip', {
                props: {
                  trigger: 'hover',
                  content: sq_name_all,
                  placement: 'top'
                }
              },
              [
                (params.row.sq_name)
              ])
            } else {
              return [
                (params.row.sq_name)
              ]
            }
          }
        },
        { title: '平均办结时间', key: 'item_time', align: 'center', sortable: true },
        { title: '全市平均办结时间', key: 'avgTime', align: 'center', sortable: true }
      ],
      columns2: [
        { title: '序号', type: 'index', width: 80, align: 'center' },
        { title: '事项名称', key: 'title', width: 150, align: 'center' },
        { title: '事项编号', key: 'item_id', width: 150, align: 'center' },
        { title: '受理量（项）', key: 'num1', width: 140, align: 'center', sortable: true },
        { title: '办结量（项）', key: 'finish_num', width: 140, align: 'center', sortable: true },
        {
          title: '办结率',
          key: 'percent',
          width: 140,
          sortable: true,
          align: 'center',
          render: (h, params) => {
            let num = 0
            if (params.row.num1) {
              num = params.row.finish_num / params.row.num1 * 100
            }
            return h('div', [h('strong', num.toFixed(2) + '%')])
          }
        },
        { title: '转件量（项）', key: 'outzhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件受理量（项）', key: 'zhuan_num', width: 200, align: 'center', sortable: true },
        { title: '转件办结量（项）', key: 'finish_zhuan_num', width: 200, align: 'center', sortable: true },
        {
          title: '办结率',
          key: 'zhuan_percent',
          width: 140,
          sortable: true,
          align: 'center',
          render: (h, params) => {
            let num = 0
            if (params.row.zhuan_num) {
              num = params.row.finish_zhuan_num / params.row.zhuan_num * 100
            }
            return h('div', [h('strong', num.toFixed(2) + '%')])
          }
        },
        {
          title: '操作',
          key: 'action',
          width: 150,
          align: 'center',
          className: 'nopadding',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'info', size: 'small' },
                style: {},
                on: {
                  click: () => {
                    this.itemDetail(params.row)
                  }
                }
              }, '办理名单')
            )
            return h('div', temp)
          }
        }
      ],
      columns3: [
        { title: '序号', type: 'index', key: 'index', width: 60, align: 'center' },
        { title: '事项名称', key: 'title', width: 100, align: 'center' },
        { title: '办理社区', key: 'company_name', align: 'center' },
        { title: '办理时间', key: 'create_time', width: 170, align: 'center' },
        { title: '办理状态', key: 'process_name', width: 110, align: 'center' },
        { title: '申请人姓名', key: 'name', width: 110, align: 'center' },
        { title: '申请人证件号', key: 'cardno', width: 170, align: 'center' },
        { title: '联系方式', key: 'mobile', width: 150, align: 'center' }
      ],
      columns5: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '事项名称', key: 'QL_NAME', align: 'center' },
        { title: '办理数量', key: 'num', align: 'center' },
        { title: '操作',
          key: 'action',
          align: 'center',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'info', size: 'small' },
                style: {},
                on: {
                  click: () => {
                    this.qlnameList(params)
                  }
                }
              }, '查看名单')
            )
            return h('div', temp)
          }

        }

      ],
      columns6: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '姓名', key: 'name', align: 'center' },
        { title: '电话', key: 'moblie', align: 'center' },
        { title: '身份证号', key: 'cardno', align: 'center' }
      ],
      columns8: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '事项名称', key: 'QL_NAME', align: 'center' },
        { title: '咨询数量', key: 'num', align: 'center' }
      ],
      columns7: [
        { title: '序号', type: 'index', width: 100, align: 'center' },
        { title: '社区名称', key: 'community', align: 'center' },
        { title: '咨询数量', key: 'num', align: 'center' },
        { title: '操作',
          key: 'action',
          align: 'center',
          render: (h, params) => {
            let temp = []
            temp.push(
              h('Button', {
                props: { type: 'info', size: 'small' },
                style: {},
                on: {
                  click: () => {
                    this.communityInfo(params)
                  }
                }
              }, '查看名单')
            )
            return h('div', temp)
          }

        }
      ],
      columns4: [
        { title: '序号', key: 'index', type: 'index', width: 80, align: 'center' },
        { title: '类别名称', key: 'title', align: 'center' },
        { title: '类别编号', slot: 'item_id', width: 400, align: 'center' },
        { title: '受理量（项）', key: 'num1', width: 200, align: 'center' },
        { title: '操作', slot: 'buttons', width: 200, align: 'center' }
      ],
      columns10: [
        { title: '序号', type: 'index', width: 80, align: 'center' },
        { title: '事项名称', key: 'QL_NAME', align: 'center' },
        { title: '事项编号', key: 'ITEM_CODE', width: 150, align: 'center' },
        { title: '事项平均办结时间', slot: 'item_time', width: 150, align: 'center' }
      ],
      forwardColumns: [
        { title: '序号', type: 'index', width: 80, align: 'center' },
        { title: '所属社区', slot: 'company_code', width: 150, align: 'center' },
        { title: '事项名称', key: 'title', width: 150, align: 'center' },
        { title: '事项编号', key: 'item_id', width: 150, align: 'center' },
        { title: '受理事项', slot: 'num1', width: 150, align: 'center' },
        { title: '办结事项', slot: 'finish_num', width: 150, align: 'center' },
        { title: '事项办结率', slot: 'item_rate', width: 150, align: 'center' },
        { title: '转件受理事项', key: 'zhuan_num', width: 150, align: 'center' },
        { title: '转件办结事项', key: 'finish_zhuan_num', width: 150, align: 'center' },
        { title: '事项转件办结率', slot: 'item_forward_rate', width: 150, align: 'center' }
      ],
      columnspopulation: [
        { title: '序号', type: 'index', key: 'index', width: 60, align: 'center' },
        { title: '社区名称', key: 'company_name', align: 'center' },
        { title: '实际人口数量', key: 'population_num', align: 'center' },
        { title: '户籍人口数量', key: 'household_num', align: 'center' },
        { title: '流动人口数量', key: 'flow_num', align: 'center' },
        { title: '填报人员姓名', key: 'update_byname', align: 'center' },
        { title: '填报人员账号', key: 'update_by', align: 'center' },
        { title: '填报时间', key: 'update_time', align: 'center' }
      ],
      stateList: [
        { key: '0', value: '待受理' },
        { key: '1', value: '办理中' },
        { key: '2', value: '办结成功' },
        { key: '3', value: '办结失败' },
        { key: '7', value: '待办结' },
        { key: '8', value: '转件中' },
        { key: '81', value: '转件办理中' },
        { key: '82', value: '转件待办结' }
      ]
    }
  },
  computed: {
    companyCode () {
      return this.$store.state.user.severUserInfo.company_code
    },
    companyGrade () {
      return this.$store.state.user.severUserInfo.company_grade - 1
    }
  },
  methods: {
    size (pageSize) {
      this.pageSize = pageSize
      this.changePage()
    },
    forward (row) {
      let rate = ((row.finish_zhuan_num / row.zhuan_num) * 100).toString().substring(0, 4) + '%'
      return rate
    },
    changePage (page) {
      this.pageNo = page
      this.forwardRate()
    },
    rate (row) {
      let finsh_num = row.finish_num - row.finish_zhuan_num
      let num = row.num1 - row.zhuan_num
      let rate = ((finsh_num / num) * 100).toString().substring(0, 4) + '%'
      return rate
    },
    forwardRate () {
      let data = {
        pageNo: this.pageNo,
        pageSize: this.pageSize
      }
      getForwardRateList(data).then(res => {
        this.forwardList = res.data.data.results
        this.totalRecord = res.data.data.totalRecord
        this.searchInfo.forw = false
      })
    },
    handleSummary ({ columns, data }) {
    },
    time (date) {
      let time = date / 3600
      let data = time.toString().substring(0, 4)
      if (data.endsWith('0') && data.length > 1) {
        data = data.substring(0, data.length - 1)
      }
      if (data.endsWith('.')) {
        data = data.substring(0, data.length - 1)
      }
      return data
    },
    orderTime () {
      getOrderAvgTimeList().then(res => {
        this.itemTimelist = res.data.data
        this.searchInfo.itemtime = false
      })
    },
    findtime (flag) {
      let datatime = {
        create_time_start: date2str(this.apptime[0]),
        create_time_end: date2str(this.apptime[1])
      }
      if (flag) {
        this.rowlist1(datatime)
      } else {
        this.allcommunity(datatime)
      }
    },
    change3 (pageNo) {
      this.currentpageNo = pageNo
      this.qlnameList(this.getparam)
    },
    change1 (pageNo) {
      this.currentpageNo = pageNo
      this.communityInfo(this.getparam)
    },
    communityInfo (param) {
      this.getparam = param
      let create_by = param.row.create_by
      let obj4 = { 'create_by': create_by,
        'pageNo': this.currentpageNo,
        'pageSize': this.currentpageSize,
        create_time_start: date2str(this.apptime[0]),
        create_time_end: date2str(this.apptime[1]) }
      byCreatebyInfoList(obj4).then(res => {
        if (res.data.errcode === 0) {
          this.listdetailss = true
          this.listdetailsdataaa = res.data.data.results
          this.totalnum = res.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '获取社区咨询量详情失败' })
        }
      })
      this.currentpageNo = 1
    },
    // 查看所有社区咨询量
    allcommunity (param) {
      findStreetNum(param).then(res => {
        if (res.data.errcode === 0) {
          this.rowlist2 = res.data.data
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '获取各社区咨询量失败' })
        }
      })
    },
    // 查看所有社区咨询量
    searchRichang (timearray) {
      console.log(timearray)
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let param = {
        start_time: date2str(timearray[0]),
        end_time: date2str(timearray[1]),
        state: orderstate
      }
      getSomeNum(param).then(res => {
        if (res.data.errcode === 0) {
          this.rc = res.data.data
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '' })
        }
      })
      dycgetSomeNum(param).then(res => {
        if (res.data.errcode === 0) {
          this.num6 = res.data.data.num6
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '' })
        }
      })
      getBuildingNum(param).then(res => {
        if (res.data.errcode === 0) {
          this.num5 = res.data.data.buildingnum
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '' })
        }
      })
    },
    // 查看事项问题办结量
    qlnameList (param) {
      this.listdetails = true
      this.getparam = param
      let qlname = param.row.QL_NAME
      let data0 = { 'QL_NAME': qlname,
        'pageNo': this.currentpageNo,
        'pageSize': this.currentpageSize,
        create_time_start: date2str(this.apptime[0]),
        create_time_end: date2str(this.apptime[1]) }
      byQlnameInfo(data0).then(res => {
        if (res.data.errcode === 0) {
          this.listdetailsdata = res.data.data.results
          this.totalnum = res.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '获取名单失败' })
        }
      })
      this.currentpageNo = 1
    },
    // 查看事项问题办结量
    rowlist1 (param) {
      byRowidList(param).then(res => {
        if (res.data.errcode === 0) {
          this.rowlist = res.data.data
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询事项咨询量失败' })
        }
      })
    },
    // 已有事项列表，页面搜索栏使用
    getItemList () {
      eventlist({}).then(res => {
        if (res.data.errcode === 0) {
          this.eventListSC = res.data.data
          this.eventListSC.unshift({ id: 0, text: '全部' })
          this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询事项劣列表失败' })
        }
      })
    },
    // 事项类型列表，页面搜索栏使用
    getTreeList () {
      treelist({}).then(res => {
        if (res.data.errcode === 0) {
          this.treelist = res.data.data
          this.treelist.unshift({ id: '', type_name: '全部' })
          this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询事项类型列表失败' })
        }
      })
    },
    // 社区统计下拉搜索框的级联查询
    getMailList (id, index, company_code) {
      if (id === 0) {
        this.mailList[index] = this.mailList[index + 'all']
        this.searchInfo['level' + (index + 1)] = 0
        return
      }
      this.searchInfo['level' + (index + 1)] = 0
      getMailLevelList({ id: id, company_code: company_code }).then(res => {
        if (res.data.errcode === 0) {
          this.mailList[index] = res.data.data
          this.mailList[index].unshift({ id: 0, title: '全部' })
          this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    // 社区统计下拉搜索框的级联查询
    getMailAllList (index) {
      getMailLevelList({ level: index + 2 }).then(res => {
        if (res.data.errcode === 0) {
          this.mailList[(index) + 'all'] = res.data.data
          this.mailList[(index) + 'all'].unshift({ id: 0, title: '全部' })
          this.mailList[index] = this.mailList[index + 'all']
          this.searchInfo['level' + (index + 1)] = 0
          this.$forceUpdate()
        } else {
          this.$Notice.error({ title: '获取信息失败', desc: '查询区域列表信息失败' })
        }
      })
    },
    // 设置人口数量
    addpopulation () {
      this.population.setnum1 = this.population.population_num
      this.population.setnum2 = this.population.household_num
      this.population.setnum3 = this.population.flow_num
      this.population.show = true
    },
    // 设置人口数量ok
    savepopulationok () {
      if (this.population.setnum1 > 100000000 || this.population.setnum2 > 100000000 || this.population.setnum3 > 100000000) {
        this.$Notice.error({ title: '请输入正确数字' })
        return
      }
      if (this.population.population_num === this.population.setnum1 &&
      this.population.household_num === this.population.setnum2 &&
      this.population.flow_num === this.population.setnum3) {
        this.$Notice.success({ title: '保存成功' })
        return
      }
      let params = {
        population_num: this.population.setnum1,
        household_num: this.population.setnum2,
        flow_num: this.population.setnum3
      }
      savePopulationNum(params).then(res => {
        if (res.data.errcode === 0) {
          this.population.population_num = this.population.setnum1
          this.population.household_num = this.population.setnum2
          this.population.flow_num = this.population.setnum3
          this.$Notice.success({ title: '保存成功' })
          this.findPopulationNumLogList(1)
        } else {
          this.$Notice.error({ title: '保存失败' })
        }
      })
      this.population.show = false
    },
    // 设置人口数量cancel
    savepopulationcancel () {
      this.population.show = false
    },
    // 获取人口数量
    getPopulationNum () {
      getPopulationNum({}).then(res => {
        if (res.data.errcode === 0) {
          this.population.population_num = res.data.data.population_num
          this.population.household_num = res.data.data.household_num
          this.population.flow_num = res.data.data.flow_num
        } else {
          this.$Notice.error({ title: '查询人口信息失败' })
        }
      })
    },
    // 获取社区人口信息变更记录
    findPopulationNumLogList (pageNo) {
      let parasm = {
        'pageNo': pageNo,
        'pageSize': this.population.pageSize
      }
      findPopulationNumLogList(parasm).then(res => {
        if (res.data.errcode === 0) {
          this.population.loglist = res.data.data.results
          this.population.totalRecord = res.data.data.totalRecord
        } else {
          this.$Notice.error({ title: '查询人口信息失败' })
        }
      })
    },
    // 点击【事项办理统计】tab时查询事项列表
    getCountData () {
      if (this.searchInfo.tab_index === 'sxbltj') {
        this.searchData1(this.searchInfo.applytime1, null)
        this.eventListSQ = this.eventListSC
      } else if (this.searchInfo.tab_index === 'worklist') {
        this.searchDatawork()
        this.eventListWK = this.eventListSC
      } else if (this.searchInfo.tab_index === 'glpm') {
        this.searchData1(this.searchInfo.applytime2, '1')
        this.eventListSQ = this.eventListSC
        this.orderTime()
        this.forwardRate()
      } else if (this.searchInfo.tab_index === 'slqst') {
        let day1 = new Date()
        for (let i = 29; i >= 0; i--) {
          let temp = date2str(day1)
          this.barData.xAxis[i] = temp.substring(5)
          this.barData.xAxisMap[temp] = i
          day1.setDate(day1.getDate() - 1)
        }
        this.searchData2()
        this.orderTime()
        this.forwardRate()
      } else if (this.searchInfo.tab_index === 'jdxhz') {
        this.searchData3()
        this.orderTime()
        this.forwardRate()
        this.eventListSQ = this.eventListSC
      } else if (this.searchInfo.tab_index === 'wtzxtj') {
        this.forwardRate()
      } else if (this.searchInfo.tab_index === 'sxblsxtj') {
        this.forwardRate()
        this.eventListSQ = this.eventListSC
      } else if (this.searchInfo.tab_index === 'sxbjltj') {
        this.forwardRate()
        this.eventListSQ = this.eventListSC
      } else if (this.searchInfo.tab_index === 'sqblsx') {
        this.searchDatatime(this.searchInfo.applytime1, null)
      } else if (this.searchInfo.tab_index === 'sqtjnew') {
        this.searchDatashequ(1)
        this.eventListSQ = this.eventListSC
      } else if (this.searchInfo.tab_index === 'sqtj') {
        this.searchData()
      } else if (this.searchInfo.tab_index === 'sqrkslgl') {
        this.findPopulationNumLogList(1)
      }
    },
    // 社区受理统计查询
    searchData () {
      this.searchInfo.loading1 = true
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        item_type: this.searchInfo.item_type,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        state: orderstate
      }
      if (this.companyGrade < '4') {
        para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
        para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : this.companyGrade
      } else {
        para.level = '4'
      }
      this.datalist = []
      getCompanyCountList(para).then(res => {
        if (res.data.errcode === 0) {
          this.datalist = res.data.data
          let totalNum = { sq_name: '合计', num: 0, finish_num: 0, percent: 0, zhuan_num: 0, outzhuan_num: 0, finish_zhuan_num: 0, zhuan_percent: 0 }
          this.datalist.forEach(function (temp1, index) {
            totalNum.num += temp1.num
            totalNum.finish_num += temp1.finish_num
            totalNum.zhuan_num += temp1.zhuan_num
            totalNum.finish_zhuan_num += temp1.finish_zhuan_num
            totalNum.outzhuan_num += temp1.outzhuan_num
          })
          totalNum.percent = totalNum.finish_num / totalNum.num * 100
          totalNum.zhuan_percent = totalNum.finish_zhuan_num / totalNum.zhuan_num * 100
          this.datalist.push(totalNum)
          this.searchInfo.loading1 = false
        } else {
          this.searchInfo.loading1 = true
          this.$Notice.error({ title: '统计失败', desc: res.data.errmsg })
        }
      })
    },
    // 社区受理统计查询
    searchDatashequ (pageNo) {
      this.searchInfo.loading1 = true
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        item_type: this.searchInfo.item_type,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        state: orderstate,
        pageNo: pageNo,
        pageSize: this.shequPageInfo.pageSize,
        asot: this.shequAsot,
        ishavezzz: this.searchInfo.ishavezzz,
        community: this.searchInfo.community
      }
      if (this.companyGrade < '4') {
        para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
        para.level = this.searchInfo.level3 ? '4' : '3'
      } else {
        para.level = '4'
      }
      this.datalistshequ = []
      getCompanyCountPageList(para).then(res => {
        let that = this
        if (res.data.errcode === 0) {
          this.datalistshequ = res.data.data.results
          this.shequPageInfo.pageNo = res.data.data.pageNo
          this.shequPageInfo.totalRecord = res.data.data.totalRecord
          // let totalNum = { sq_name: '合计', num: 0, finish_num: 0, percent: 0, zhuan_num: 0, finish_zhuan_num: 0, zhuan_percent: 0 }
          this.datalistshequ.forEach(function (temp1, index) {
            temp1.item_time = that.formatDuring(temp1.item_time)
            temp1.avgTime = that.formatDuring(temp1.avgTime)
          })
          // totalNum.percent = totalNum.finish_num / totalNum.num * 100
          // totalNum.zhuan_percent = totalNum.finish_zhuan_num / totalNum.zhuan_num * 100
          // this.datalistshequ.push(totalNum)
          this.searchInfo.loading1 = false
        } else {
          this.searchInfo.loading1 = true
          this.$Notice.error({ title: '统计失败', desc: res.data.errmsg })
        }
      })
    },
    // 工作量统计查询
    searchDatawork () {
      this.searchInfo.loading1 = true
      // this.searchInfo.loading1 = true
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        sq_name: this.searchInfo.sq_name,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        type: this.searchInfo.workType,
        item_type: this.searchInfo.item_type,
        state: orderstate
      }
      if (this.companyGrade < '4') {
        para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
        para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : this.companyGrade
      } else {
        para.level = '4'
      }
      if (this.searchInfo.sq_name) {
        para.level = '4'
      }
      this.searchInfo.workLevel = para.level
      this.datalistwork = []
      getWorkList(para).then(res => {
        if (res.data.errcode === 0) {
          this.datalistwork = res.data.data
          let totalNum = { sq_name: '合计', num: 0, finish_num: 0, percent: 0, outzhuan_num: 0, zhuan_num: 0, finish_zhuan_num: 0, zhuan_percent: 0 }
          this.datalistwork.forEach(function (temp1, index) {
            totalNum.num += temp1.num
            totalNum.finish_num += temp1.finish_num
            totalNum.zhuan_num += temp1.zhuan_num
            totalNum.finish_zhuan_num += temp1.finish_zhuan_num
            totalNum.outzhuan_num += temp1.outzhuan_num
          })
          totalNum.percent = totalNum.finish_num / totalNum.num * 100
          totalNum.zhuan_percent = totalNum.finish_zhuan_num / totalNum.zhuan_num * 100
          this.datalistwork.push(totalNum)
          this.searchInfo.loading1 = false
          // if (para.level === '4') {
          //   this.columns1[1] = {
          //     title: '办理机构名称',
          //     key: 'sq_name',
          //     width: 200,
          //     align: 'center',
          //     render: (h, params) => {
          //       return h('Poptip', {
          //         props: {
          //           trigger: 'hover',
          //           content: params.row.sq_name,
          //           placement: 'top'
          //         }
          //       },
          //       [
          //         h('Tag', params.row.sq_name_all)
          //       ])
          //     }
          //   }
          //   console.log('this.columns1')
          //   console.log(this.columns1)
          // }
        } else {
          this.searchInfo.loading1 = true
          this.$Notice.error({ title: '统计失败', desc: res.data.errmsg })
        }
      })
    },
    // 社区办理时限
    searchDatatime () {
      let that = this
      this.searchInfo.loading1 = true
      // this.searchInfo.loading1 = true
      let para = {
        item_id: this.searchInfo.item_id,
        sq_name: this.searchInfo.sq_name,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        type: this.searchInfo.workType,
        item_type: this.searchInfo.item_type
      }
      if (this.companyGrade < '4') {
        para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
        para.level = this.searchInfo.level3 ? '4' : this.searchInfo.level2 ? '3' : this.searchInfo.level1 ? '2' : this.companyGrade
      } else {
        para.level = '4'
      }
      if (this.searchInfo.sq_name) {
        para.level = '4'
      }
      this.searchInfo.workLevel = para.level
      this.datalisttime = []
      getNewOrderAvgTimeList(para).then(res => {
        if (res.data.errcode === 0) {
          res.data.data.forEach(function (temp1, index) {
            temp1.item_time = that.formatDuring(temp1.item_time)
            temp1.avgTime = that.formatDuring(temp1.avgTime)
          })
          this.datalisttime = res.data.data
          this.searchInfo.loading1 = false
        } else {
          this.searchInfo.loading1 = true
          this.$Notice.error({ title: '统计失败', desc: res.data.errmsg })
        }
      })
    },
    // 事项统计查询,type=1表示归类排名，否则表示事项办理统计排名
    searchData1 (timearray, type) {
      this.searchInfo.loading2 = true
      this.searchInfo.loading4 = true
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        item_type: this.searchInfo.item_type,
        // ql_name: this.searchInfo.item_name,
        type: type,
        start_time: date2str(timearray[0]),
        end_time: date2str(timearray[1]),
        state: orderstate
      }
      var up_id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
      para.up_id = up_id.toString()
      this.itemlist = []
      this.sortitemlist = []
      getPeriodList(para).then(res => {
        if (res.data.errcode === 0) {
          if (type === '1') {
            this.sortitemlist = res.data.data
            let totalNum = { title: '合计', item_id: 'all', num1: 0 }
            this.sortitemlist.forEach(function (temp1, index) {
              temp1.name = temp1.title
              temp1.value = temp1.num1
              totalNum.num1 += temp1.num1
            })
            this.sortitemlist.push(totalNum)
            console.log(this.sortitemlist, '柱状图数据')
            this.searchInfo.loading4 = false
            this.searchInfo.runPie++
            this.barDataTab3.xAxis = []
            this.barDataTab3.xAxisMap = {}
            this.barDataTab3.seriesData = [
              { name: '受理量', data: [], type: 'bar' }
            ]
            let that = this
            let barDataTab3 = that.barDataTab3
            res.data.data.forEach(function (item, index) {
              console.log(item.title)
              that.barDataTab3.xAxis.push(item.title)
              that.barDataTab3.xAxisMap[item.title] = index
              console.log(that.barDataTab3.xAxisMap[item.title], '@@@@')
              let i = barDataTab3.xAxisMap[item.title]
              barDataTab3.seriesData[0].data[i] = item.num1
            })
            this.searchInfo.runTab3Bar2 = parseInt(this.searchInfo.runTab3Bar2) + 1 + ''
            this.searchInfo.barflag = true
            console.log(this.barDataTab3, 'this.barDataTab3')
          } else {
            this.itemlist = res.data.data
            this.searchInfo.loading2 = false
          }
          // this.searchInfo.loading4 = false
        } else {
          this.searchInfo.loading4 = true
          this.searchInfo.loading2 = true
          this.$Notice.error({ title: '统计失败', desc: '' })
        }
      })
    },
    // 归类排名详情
    glpmInfoAction (data) {
      // 组装外层搜索参数
      data.ql_name = this.searchInfo.item_name
      data.type = '1'
      data.start_time = date2str(this.searchInfo.applytime2[0])
      data.end_time = date2str(this.searchInfo.applytime2[1])
      let up_id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
      data.up_id = up_id.toString()
      // modal配置
      this.glpmModal.title = data.title + '- 详情'
      this.glpmModal.data = data
      this.$refs.glpmModal.modalAction()
    },
    // 月度受理趋势图 全部事项和单个事项
    searchData2 () {
      for (let i = 0; i < 30; i++) {
        this.barData.seriesData[0].data[i] = 0
      }
      this.searchInfo.barflag = false
      var up_id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
      let para = {
        item_id: this.searchInfo.item_id2,
        up_id: up_id.toString(),
        start_time: date2str(this.searchInfo.applytime3[0]),
        end_time: date2str(this.searchInfo.applytime3[1]),
        type: this.searchInfo.AcceptListType
      }
      getAcceptList(para).then(res => {
        if (res.data.errcode === 0) {
          this.barData.xAxis = []
          this.barData.xAxisMap = {}
          this.barData.seriesData = [
            { name: '受理量', data: [], type: 'bar' },
            { name: '同比受理量', data: [], type: 'bar' },
            { name: '环比受理量', data: [], type: 'bar' }
          ]
          let that = this
          let barData = that.barData
          res.data.data.forEach(function (item, index) {
            that.barData.xAxis.push(item.datenamea)
            that.barData.xAxisMap[item.datenamea] = index
            let i = barData.xAxisMap[item.datenamea]
            barData.seriesData[0].data[i] = item.numa
            barData.seriesData[1].data[i] = item.numb
            barData.seriesData[2].data[i] = item.numc
          })
          this.searchInfo.runBar = parseInt(this.searchInfo.runBar) + 1 + ''
          this.searchInfo.barflag = true
        } else {
          this.$Notice.error({ title: '统计失败', desc: '' })
        }
      })
    },
    searchData3 () {
      this.searchInfo.loadingjdxhz = true
      let para = {
        item_id: this.searchInfo.item_id,
        item_type: this.searchInfo.item_type,
        start_time: date2str(this.searchInfo.applytime3[0]),
        end_time: date2str(this.searchInfo.applytime3[1]),
        level: '1'
      }
      if (para.start_time) {
        this.modalTab5Info.title = para.start_time + ' ~ ' + para.end_time + ' 汇总统计报告'
      } else {
        this.modalTab5Info.title = '运营至今汇总统计报告'
      }
      this.searchInfo.tab5Pie1 = false
      getPeriodList(para).then(res => {
        if (res.data.errcode === 0) {
          this.tab5list1 = []
          if (res.data.data.length > 10) {
            for (let i = 0; i < 10; i++) {
              let temp22 = res.data.data[i]
              this.tab5list1.push({ id: i, name: temp22.title, value: temp22.num1 })
            }
            let templist1 = { id: 10, name: '其他事项', value: 0 }
            for (let i = 10; i < res.data.data.length; i++) {
              templist1.value += res.data.data[i].num1
            }
            this.tab5list1.push(templist1)
          } else {
            for (let i = 0; i < res.data.data.length; i++) {
              let temp22 = res.data.data[i]
              this.tab5list1.push({ id: i, name: temp22.title, value: temp22.num1 })
            }
          }
          this.modalTab5Info.maxItem = res.data.data[0].num1
          this.modalTab5Info.maxItem2 = res.data.data[0].finish_num
          this.modalTab5Info.maxItem3 = this.modalTab5Info.maxItem2 / this.modalTab5Info.maxItem * 100
          this.modalTab5Info.maxItemName = res.data.data[0].title
          this.searchInfo.runTab5Pie1++
          this.searchInfo.tab5Pie1 = true
        } else {
          this.$Notice.error({ title: '统计失败', desc: '' })
        }
      })
      this.searchInfo.tab5Bar2 = false
      getCompanyCountList(para).then(res => {
        if (res.data.errcode === 0) {
          this.stageSummaryList = res.data.data
          let barDataTab5 = this.barDataTab5
          let tempModal = this.modalTab5Info
          barDataTab5.xAxis = []
          barDataTab5.seriesData[0].data = []
          barDataTab5.seriesData[1].data = []
          this.stageSummaryList.forEach(function (temp1, index) {
            temp1.id = index
            tempModal.num += temp1.num
            tempModal.finish_num += temp1.finish_num
            barDataTab5.xAxis.push(temp1.sq_name)
            barDataTab5.seriesData[0].data.push(temp1.num)
            barDataTab5.seriesData[1].data.push(temp1.finish_num)
          })
          this.modalTab5Info.maxSQ = this.stageSummaryList[0].num
          this.modalTab5Info.maxSQ2 = this.stageSummaryList[0].finish_num
          this.modalTab5Info.maxSQ3 = this.modalTab5Info.maxSQ2 / this.modalTab5Info.maxSQ * 100
          this.modalTab5Info.maxSQname = this.stageSummaryList[0].sq_name
          this.searchInfo.runTab5Bar2 = parseInt(this.searchInfo.runTab5Bar2) + 1 + ''
          this.searchInfo.tab5Bar2 = true
        } else {
          this.$Notice.error({ title: '统计失败', desc: res.data.errmsg })
        }
      })
      this.searchInfo.loadingjdxhz = false
    },
    report () {
      this.modalTab5Info.show = true
    },
    // 导出社区统计数据
    exportData () {
      console.log(this.datalist, 'cccccccc')
      if (this.datalist.length === 0) {
        this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
        return
      }
      let today = new Date()
      this.$refs.table1.exportCsv({
        filename: '区域受理统计' + date2str(today),
        original: false
      })
    },
    pranttable (id) {
      let subOutputRankPrint = document.getElementById(id)
      let newContent = subOutputRankPrint.innerHTML
      document.body.innerHTML = newContent
      setTimeout(function () {
        window.print()
        window.location.reload()
        // document.body.innerHTML = oldContent
        // return false
      }, 1000)
    },
    // 导出社区统计数据
    exportDatawork () {
      if (this.datalistwork.length === 0) {
        this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
        return
      }
      let today = new Date()
      this.$refs.tablework.exportCsv({
        filename: '工作量统计' + date2str(today),
        columns: this.columnswork,
        original: false
      })
    },
    // 导出社区办理时限统计数据
    exportDatatime () {
      if (this.datalisttime.length === 0) {
        this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
        return
      }
      let today = new Date()
      this.$refs.tabletime.exportCsv({
        filename: '社区办理时限统计' + date2str(today),
        columns: this.columnstime,
        original: false
      })
    },
    // 导出社区统计数据
    exportDatashequ () {
      // if (this.datalistshequ.length === 0) {
      //   this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
      //   return
      // }
      // let today = new Date()
      // this.$refs.datalistshequ.exportCsv({
      //   filename: '社区受理统计' + date2str(today),
      //   columns: this.columns1,
      //   original: false
      // })
      this.searchInfo.loading3 = true
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        item_type: this.searchInfo.item_type,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        state: orderstate,
        asot: this.shequAsot,
        pageNo: 1,
        pageSize: 2000
      }
      if (this.companyGrade < '4') {
        para.id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
        para.level = this.searchInfo.level3 ? '4' : '3'
      } else {
        para.level = '4'
      }
      getCompanyCountExcelList(para).then(res => {
        let data = res.data
        let that = this
        if (res.data.errcode === 0) {
          this.searchInfo.loading3 = false
          let exportData = data.data
          let today = new Date()
          this.$refs.tableshequ.exportCsv({
            filename: '社区受理统计' + date2str(today),
            columns: this.columnsshequ,
            data: exportData.map((item, index) => {
              // 序号
              item.index = index + 1
              // 办理机构名称
              item.sq_name = item.sq_name
              // 办理状态
              item.num = item.num
              // 申请人姓名
              item.finish_num = item.finish_num
              // 申请人证件号
              item.zhuan_num = item.zhuan_num
              // 联系方式
              item.finish_zhuan_num = item.finish_zhuan_num
              item.item_time = that.formatDuring(item.item_time)
              item.avgTime = that.formatDuring(item.avgTime)
              item.population_num = item.population_num
              item.percent_pop = item.percent.toFixed(2) + '%'
              item.zhuan_percent_pop = item.zhuan_percent.toFixed(2) + '%'
              return item
            })
          })
        } else {
          this.searchInfo.loading3 = true
          this.$Notice.error({ title: '查询失败', desc: '获取办理人员名单失败' })
        }
      })
    },
    // 导出事项统计
    exportData1 () {
      if (this.itemlist.length === 0) {
        this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
        return
      }
      let today = new Date()
      this.$refs.table2.exportCsv({
        filename: '事项统计' + date2str(today),
        original: false
      })
    },
    itemDetailsize (pageNo) {
      this.itemModalInfo.pageSize = pageNo
      this.changeItemDetailPageNo()
    },
    changeItemDetailPageNo (pageNo) {
      this.itemModalInfo.pageNo = pageNo
      this.getHandleList(pageNo)
    },
    // 事项统计后查询每个事项的办理人员名单
    itemDetail (item) {
      this.itemModalInfo.title = item.title + '-办理人员名单'
      this.itemModalInfo.item_id = item.item_id
      this.itemModalInfo.show = true
      this.itemModalInfo.pageNo = 1
      console.log(this.itemModalInfo, 'llllllllllllll')
      this.getHandleList(1)
    },
    // 每个事项办理人员名单列表
    getHandleList (pageNo) {
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.itemModalInfo.item_id,
        pageNo: pageNo,
        pageSize: this.itemModalInfo.pageSize,
        state: orderstate
      }
      var up_id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
      para.up_id = up_id.toString()
      getItemHandleList(para).then(res => {
        if (res.data.errcode === 0) {
          this.itemhandlelist = res.data.data.results
          this.searchInfo.loading3 = false
          this.itemModalInfo.totalRecord = res.data.data.totalRecord
        } else {
          this.searchInfo.loading3 = true
          this.$Notice.error({ title: '查询失败', desc: '获取办理人员名单失败' })
        }
      })
    },
    changePageNo (pageNo) {
      this.itemModalInfo.currentPageNo = pageNo
      this.init(params)
    },
    changeworksize (pageNo) {
      this.workModalInfo.pageSize = pageNo
      this.changeworkPageNo()
    },
    changeworkPageNo (pageNo) {
      this.workModalInfo.pageNo = pageNo
      this.findWorkOrderList(pageNo)
    },
    changeshequPageNo (pageNo) {
      this.shequPageInfo.pageNo = pageNo
      // this.shequPageInfo.pageNo = parseInt(pageNo)
      this.searchDatashequ(pageNo)
    },
    changeshequsize (pageNo) {
      this.shequPageInfo.pageSize = pageNo
      this.changeshequPageNo()
    },
    changepopulationPageNo (pageNo) {
      this.population.pageNo = pageNo
      this.findPopulationNumLogList(pageNo)
    },
    changepopulationPageSize (pageNo) {
      this.population.pageSize = pageNo
      this.changepopulationPageNo()
    },
    changeItem (item_type) {
      let that = this
      that.eventListWK = []
      that.eventListSC.forEach(function (temp1, index) {
        if (temp1.org_code === item_type) {
          that.eventListWK.push(temp1)
        }
      })
      that.eventListWK.unshift({ id: 0, text: '全部' })
    },
    changeItem1 (item_type) {
      let that = this
      that.eventListSQ = []
      that.eventListSC.forEach(function (temp1, index) {
        if (temp1.org_code === item_type) {
          that.eventListSQ.push(temp1)
        }
      })
      that.eventListSQ.unshift({ id: 0, text: '全部' })
    },
    // 事项统计后查询每个事项的办理人员名单
    workOrderList (item) {
      this.workModalInfo.title = item.sq_name_all ? (item.sq_name_all + ':' + item.sq_name) : item.sq_name + '-办理人员名单'
      this.workModalInfo.create_by = item.create_by
      this.workModalInfo.id = item.id
      this.workModalInfo.sq_name = item.sq_name
      this.workModalInfo.sq_name_all = item.sq_name_all
      this.workModalInfo.show = true
      this.workModalInfo.pageNo = 1
      this.findWorkOrderList(1)
    },
    // 每个事项办理人员名单列表
    findWorkOrderList (pageNo) {
      console.log('pageNo:' + pageNo)
      console.log('workpageNo:' + this.workModalInfo.pageNo)
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        create_by: this.workModalInfo.create_by,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        item_type: this.searchInfo.item_type,
        id: this.workModalInfo.id,
        sq_name: this.workModalInfo.sq_name,
        sq_name_all: this.workModalInfo.sq_name_all,
        level: this.searchInfo.workLevel,
        pageNo: pageNo,
        pageSize: this.workModalInfo.pageSize,
        state: orderstate
      }
      findWorkOrderList(para).then(res => {
        if (res.data.errcode === 0) {
          this.itemhandlelist = res.data.data.results
          this.searchInfo.loading3 = false
          this.workModalInfo.totalRecord = res.data.data.totalRecord
        } else {
          this.searchInfo.loading3 = true
          this.$Notice.error({ title: '查询失败', desc: '获取办理人员名单失败' })
        }
      })
    },
    // 导出社区统计数据
    exportDataworkorder () {
      let orderstate = ''
      this.searchInfo.orderstateList.forEach(function (temp1, index) {
        if (orderstate === '') {
          orderstate = temp1
        } else {
          orderstate += ',' + temp1
        }
      })
      let para = {
        item_id: this.searchInfo.item_id,
        create_by: this.workModalInfo.create_by,
        start_time: date2str(this.searchInfo.applytime[0]),
        end_time: date2str(this.searchInfo.applytime[1]),
        item_type: this.searchInfo.item_type,
        id: this.workModalInfo.id,
        sq_name: this.workModalInfo.sq_name,
        sq_name_all: this.workModalInfo.sq_name_all,
        level: this.searchInfo.workLevel,
        state: orderstate
      }
      findWorkOrderToExcelList(para).then(res => {
        let data = res.data
        if (res.data.errcode === 0) {
          this.searchInfo.loading3 = false
          let exportData = data.data
          this.$refs.table3.exportCsv({
            filename: this.workModalInfo.title,
            columns: this.columns3,
            data: exportData.map((item, index) => {
              // 序号
              item.index = index + 1
              // 办理社区
              item.company_name = item.company_name
              // 办理时间
              item.create_time = item.create_time
              // 办理状态
              item.process_name = item.process_name
              // 申请人姓名
              item.name = item.name
              // 申请人证件号
              item.cardno = item.cardno
              // 联系方式
              item.mobile = item.mobile
              // { title: '序号', type: 'index', width: 60, align: 'center' },
              // { title: '办理社区', key: 'company_name', align: 'center' },
              // { title: '办理时间', key: 'create_time', width: 170, align: 'center' },
              // { title: '办理状态', key: 'process_name', width: 110, align: 'center' },
              // { title: '申请人姓名', key: 'name', width: 110, align: 'center' },
              // { title: '申请人证件号', key: 'cardno', width: 170, align: 'center' },
              // { title: '联系方式', key: 'mobile', width: 150, align: 'center' }
              return item
            })
          })
        } else {
          this.searchInfo.loading3 = true
          this.$Notice.error({ title: '查询失败', desc: '获取办理人员名单失败' })
        }
      })
    },
    // 导出人员名单功能暂停
    // exportData2 () {
    //   if (this.itemhandlelist.length === 0) {
    //     this.$Notice.warning({ title: '导出失败', desc: '无统计数据' })
    //     return
    //   }
    //   this.$refs.table3.exportCsv({
    //     filename: this.itemModalInfo.title,
    //     original: false
    //   })
    // }
    // 导出社区统计数据
    exportData3 () {
      let para = {
        item_id: this.itemModalInfo.item_id
      }
      var up_id = this.searchInfo.level3 || this.searchInfo.level2 || this.searchInfo.level1 || ''
      para.up_id = up_id.toString()
      getItemHandleToExcelList(para).then(res => {
        let data = res.data
        if (res.data.errcode === 0) {
          this.searchInfo.loading3 = false
          let exportData = data.data
          this.$refs.table3.exportCsv({
            filename: this.itemModalInfo.title,
            columns: this.columns3,
            data: exportData.map((item, index) => {
              // 序号
              item.index = index + 1
              // 办理社区
              item.company_name = item.company_name
              // 办理时间
              item.create_time = item.create_time
              // 办理状态
              item.process_name = item.process_name
              // 申请人姓名
              item.name = item.name
              // 申请人证件号
              item.cardno = item.cardno
              // 联系方式
              item.mobile = item.mobile
              // { title: '序号', type: 'index', width: 60, align: 'center' },
              // { title: '办理社区', key: 'company_name', align: 'center' },
              // { title: '办理时间', key: 'create_time', width: 170, align: 'center' },
              // { title: '办理状态', key: 'process_name', width: 110, align: 'center' },
              // { title: '申请人姓名', key: 'name', width: 110, align: 'center' },
              // { title: '申请人证件号', key: 'cardno', width: 170, align: 'center' },
              // { title: '联系方式', key: 'mobile', width: 150, align: 'center' }
              return item
            })
          })
        } else {
          this.searchInfo.loading3 = true
          this.$Notice.error({ title: '查询失败', desc: '获取办理人员名单失败' })
        }
      })
    },
    formatDuring (mss) {
      let days = Math.floor(mss / (1 * 60 * 60 * 24))
      let hours = Math.floor((mss % (1 * 60 * 60 * 24)) / (1 * 60 * 60))
      let minutes = Math.floor((mss % (1 * 60 * 60)) / (1 * 60))
      let seconds = Math.round((mss % (1 * 60)) / 1)
      let ret = days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒'
      return ret
    }
  },
  mounted () {
    console.log(this.searchInfo.ishavezzz)
    this.allcommunity()
    this.rowlist1()
    console.log(this.companyGrade)
    if (this.companyGrade === 2) {
      this.getMailList(null, 1, this.companyCode)
    } else if (this.companyGrade === 3) {
      this.getMailList(null, 2, this.companyCode)
    } else {
      this.getMailList(null, 0, null)
    }
    this.getMailAllList(1)
    this.getMailAllList(2)
    // this.getMailList(null, 0, null)
    this.getItemList()
    this.searchData()
    this.getTreeList()
    this.searchData3()
    this.orderTime()
    this.forwardRate()
    this.searchDatashequ()
    if (this.companyGrade === 4) {
      this.getPopulationNum()
    }
  }
}
</script>
